def hello(s):
    numbers = []
    symbols = {')': '(', ']': '[', '}': '{', '>': '<'}

    opening_symbols = set(symbols.values())
    closing_symbols = set(symbols.keys())

    for i in s:

        if i in opening_symbols:
            numbers.append(i)

        elif i in closing_symbols:

            if not numbers:
                return False
                if numbers[-1] != symbols[i]:
                    return False
                numbers.pop()

    return not numbers


SymbolsPrint = input("Введите скобочную последовательность:")

print(hello(SymbolsPrint))
